package huawei.js2025;

import java.util.Scanner;

/**
 * 响应报文时间
 */
public class Question40 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxRespTime = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int T = sc.nextInt();
            int M = sc.nextInt();

            int time = 0;
            if (M < 128) {
                time = M;
            } else {
                int exp = (M & 0x70) >> 4; // 高5-7位
                int mant = M & 0x0f; // 第1-4位
                time = (mant * 0x10) << (exp + 3);
            }

            maxRespTime = Math.min(maxRespTime, time + T);
        }

        System.out.print(maxRespTime);
    }
}
